import React from 'react';
import { observer } from 'mobx-react-lite';

import store from '@/store';
import useIpcListen from '@/hooks/useIpcListen';
import { WindowListener } from '@/type';
import Styles from './index.module.less';

export const Home: React.FC = React.memo(
    observer(() => {
        const { app } = store.useStore();
        const ipcListen = useIpcListen();

        ipcListen(WindowListener.ready, (_: unknown, value) => {
            console.log('electron 启动成功...', value);
        });

        return (
            <section className={Styles.home}>
                mobx value is:{app.appName}
            </section>
        );
    })
);
